package com.four.order.controller;

import com.four.common.utils.R;
import com.four.order.entity.OrRemark;
import com.four.order.service.RemarkService;
import com.four.order.util.OssUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author lky
 * @version 1.0
 * @date 2022/1/13 9:30
 */
@RestController
@RequestMapping("remark")
public class RemarkController {

    @Autowired
    private RemarkService remarkService;

    /**
     * 评论
     * @return list
     */
    @GetMapping("/list")
    public R findAll(){
        List<OrRemark> findAll = remarkService.findAll();
        return R.ok().put("list",findAll);
    }
    /**
     * 图片上传
     * @param file：文件
     * @return ：返回图片路径
     */
    @PostMapping("/uploadImg")
    public R uploadImg(@RequestBody MultipartFile file) {
        String s = OssUtils.uploadFile(file);
        return R.ok().put("url",s);
    }





}
